package com.lagou.edu.course.api;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lagou.edu.course.api.dto.CourseDTO;
import com.lagou.edu.course.api.param.CourseQueryParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * TODO
 *
 * @author lm
 * @since 2021/10/25 11:04
 */
@FeignClient(value = "edu-course-boot", path = "/course")
public interface CourseRemoteService {
    /**
     * 获取选课列表
     *
     * @param userId
     * @return
     */
    @GetMapping("/getAllCourse")
    List<CourseDTO> getAllCourses(@RequestParam(required = false, name = "userId") Integer userId);

    /**
     * 获取已购课程信息
     *
     * @param userId 用户ID
     * @return 已购课程
     */
    @GetMapping("/getPurchasedCourse")
    List<CourseDTO> getPurchasedCourse(@RequestParam("userId") Integer userId);

    /**
     * 获取课程详情
     *
     * @param courseId
     * @return
     */
    @GetMapping("/getCourseById")
    CourseDTO getCourseById(@RequestParam("courseId") Integer courseId, @RequestParam("userId") Integer userId);

    /**
     * 更新课程
     *
     * @param courseDTO 课程
     * @return 更新结果
     */
    @PostMapping(value = "/saveOrUpdateCourse", consumes = "application/json")
    boolean saveOrUpdateCourse(@RequestBody CourseDTO courseDTO);

    /**
     * 更改课程状态
     *
     * @param courseId 课程ID
     * @param status   状态
     * @return 修改结果
     */
    @GetMapping("/changeState")
    boolean changeState(@RequestParam("courseId") Integer courseId, @RequestParam("status") Integer status);

    /**
     * 分页查询课程
     *
     * @param courseQueryParam 查询参数
     * @return 课程
     */
    @PostMapping("/getQueryCourses")
    Page<CourseDTO> getQueryCourses(@RequestBody CourseQueryParam courseQueryParam);

//
//    @PostMapping(value = "/getQueryCourses",consumes = "application/json")
//    PageResultDTO<CourseDTO> getQueryCourses( @RequestBody CourseQueryParam courseQueryParam);
}
